<?php
session_start();
$email=$_SESSION['email'];
$_SESSION['languages']="English - Sinhala";
 include ('headerforsuggestion.php');
 include_once('databaseconnection.php');
 
  

$query = "SELECT * FROM suggestions WHERE language!='Tamil'";   
$result = mysql_query($query);

echo "<table border='1'  cellspacing='1' cellpadding='2'  align='left' width='100%'>
<tr>
<th>Term</th>
<th>Domain</th>
<th>Language</th>
<th>Suggested Meaning</th>
<th>Status</th>
<th>Suggested Date</th>

<th>Likes</th>
<th>Votes</th>
<th>More</th>

</tr>";
while($row=mysql_fetch_array($result))
{

echo "<tr>";
$term=$row['term'];
echo "<td width='15%'>".$row['term']."<input type='hidden' name='butt' value='$term'</td>";

echo "<td width='15%'>".$row['domain']."</td>";

echo "<td width='15%'>".$row['language']."</td>";
$sugg=$row['suggestion'];
echo "<td width='20%'>".$row['suggestion']."<input type='hidden' name='butt1' value='$sugg'</td>";
echo "<td width='12%'>".$row['status']."</td>";
echo "<td width='10%'>".$row['suggested_date']."</td>";
//echo "<td width='10%'>".$row['suggested_by']."</td>";

//echo "<td width='16%'>".$row['comments']."</td>";


//echo "<td width='9%'><textarea rows='1' cols='9' name='comm'></textarea><input type='submit' name='$term' value='add comment'/><input type='hidden' name='butt' value='$term'</td>";




//echo "<td width='3%'><a href='Suggestion.php'>like</a></td>";
//echo "<td width='5%'>".$row['votes']."</td>";
$resultlike=mysql_query("SELECT * FROM likesuggestion where email='$email' AND term='$term' AND suggestion='$sugg' ");
if(!$resultlike) echo "invalid";
if (mysql_num_rows($resultlike) >= 1) 
  {

//echo "<td width='3%'><a href='home2.php'>Unlike</a></td>";



$like='Unlike';
echo "<td width='3%'><a href='likesuggestion.php?lis=$term.$sugg.$like'>Unlike</a></td>";

}
else
{
//echo "<td width='3%'><a href='home2.php'>like</a></td>";
$like='like';
//echo "<td width='5%'><input type='submit' name='$term' value='like'/>";
echo "<td width='3%'><a href='likesuggestion.php?lis=$term.$sugg.$like'>like</a></td>";

}
/*echo "<input type='hidden' name='butt' value='$term'>";
echo "<input type='hidden' name='butt1' value='$sugg'>";
echo "<input type='hidden' name='like' value='$like'>";*/
//echo "<td width='7%'>".$row['votes']."</td>";
$votes=$row['votes'];
echo "<td width='7%'><a href='votesofsugg.php?err=$term.$sugg'>".$votes."</a></td>";

//echo "<td width='5%'><input type='submit' name='$term' value='More'/></td>";

echo "<td width='3%'><a href='updateSuggestionComment.php?lis=$term.$sugg'>More</a></td>";


echo "</tr>";
}
echo "</table>";

include ("footer.php");
?>




